<?php
	class wrapper{
		public static function HTML_breadcrumps($data){
			$HTML_data = '';
				$HTML_data .= '<div class="bread-crumps">';
				// get first link
					$r = $_GET['r'];
					$split =  explode('/',$r);
					$HTML_data.= ' >> '.$this->HTML_link(str_replace('_',' ',$split[0]),$split[0].'/index');
				// end
					foreach($data as $key=>$val){
						if($val!=''){
							$HTML_data.= ' >> '.$this->HTML_link($key,$val);
						}else{
							$HTML_data.=' >> '.$key;
						}
					}
					//$HTML_data.= $data;
				$HTML_data .= '</div><br/>';
			echo $HTML_data;
		}
		public static function HTML_listView($labels,$dataArray){
			echo '<div class="default">';
				echo '<table>';
					echo '<tr>';
						foreach($labels as $key => $val){
							echo '<th>'.$labels[$key].'</th>';
						}
					echo '</tr>';
						$count = 0;
						foreach($dataArray as $val){
							$count++;
							echo '<tr>';
								foreach(array_keys($labels) as $key){
									echo '<td>'.$val[$key].'</td>';
								}
							echo '</tr>';
						}
						if($count==0){
							echo '<tr>';
								echo '<td colspan="7">No data available</td>';
							echo '</tr>';
						}
				echo '</table>';
			echo '</div>';
		}
		
		public static function HTML_link($options){
			$display = true;
			$data="";
				$data .= '<a href="'.$_SERVER['PHP_SELF'].'?r='.$options['request'].'" >';
					$data.=$options['label'];
				$data .='</a>';
				if(array_key_exists('show', $options)){
					if($options['show']){
						echo $data;
					}
				}else{
					echo $data;
				}
		}
		
		/*
		 * ajax controllers
		 * 
		 */
		public static function HTML_ajaxLink(){
			echo "hello";
		}
		
	}